package com.ting.test.algorithms.大厂刷题班;

import com.ting.test.algorithms.二叉树.TreeNode;

public class 有序数组转化为二插搜索树 {
    public static void main(String[] args) {
        int[] arr1 = new int[]{1, 2, 3, 0, 0, 0};
        TreeNode node = new TreeNode(3);
        TreeNode es = process(arr1, 0, arr1.length);
    }

    private static TreeNode process(int[] arr1, int L, int R) {
        if (L < R) {
            return null;

        }
        if (L == R) {
            return new TreeNode(arr1[L]);

        }
        int M = L + (R - L) / 2;

        TreeNode node = new TreeNode(arr1[M]);
        node.left = process(arr1, L, M - 1);
        node.left = process(arr1, M + 1, M);
        return node;
    }

}
